#!/bin/bash
clear
if [[ "$EUID" -ne 0 ]]; then
    echo -e "\033[1;31mScript need to be run as root!\033[0m"; exit 1
fi

if [[ ! -d /usr/local/plugins ]]; then
    mkdir /usr/local/plugins
fi

wget -q -O /usr/local/bin/menu 'https://raw.githubusercontent.com/cybertize/doctype/default/plugins/menu' && \
chmod +x /usr/local/bin/menu

# dropbear & openvpn
wget -q -O /usr/local/plugins/trial.sh 'https://raw.githubusercontent.com/cybertize/doctype/default/plugins/sshdovpn/trial_acc.sh'
wget -q -O /usr/local/plugins/create.sh 'https://raw.githubusercontent.com/cybertize/doctype/default/plugins/sshdovpn/add_acc.sh'
wget -q -O /usr/local/plugins/renew.sh 'https://raw.githubusercontent.com/cybertize/doctype/default/plugins/sshdovpn/renew_acc.sh'
wget -q -O /usr/local/plugins/lists.sh 'https://raw.githubusercontent.com/cybertize/doctype/default/plugins/sshdovpn/lists_acc.sh'
wget -q -O /usr/local/plugins/login.sh 'https://raw.githubusercontent.com/cybertize/doctype/default/plugins/sshdovpn/login_acc.sh'
wget -q -O /usr/local/plugins/lock.sh 'https://raw.githubusercontent.com/cybertize/doctype/default/plugins/sshdovpn/lock_acc.sh'
wget -q -O /usr/local/plugins/unlock.sh 'https://raw.githubusercontent.com/cybertize/doctype/default/plugins/sshdovpn/unlock_acc.sh'
wget -q -O /usr/local/plugins/delete.sh 'https://raw.githubusercontent.com/cybertize/doctype/default/plugins/sshdovpn/delete_acc.sh'

# shadowsocks-libev
wget -q -O /usr/local/plugins/add-ss.sh 'https://raw.githubusercontent.com/cybertize/doctype/default/plugins/sslibev/add_libev.sh'
wget -q -O /usr/local/plugins/renew-ss.sh 'https://raw.githubusercontent.com/cybertize/doctype/default/plugins/sslibev/renew_libev.sh'
wget -q -O /usr/local/plugins/lists-ss.sh 'https://raw.githubusercontent.com/cybertize/doctype/default/plugins/sslibev/lists_libev.sh'
wget -q -O /usr/local/plugins/disable-ss.sh 'https://raw.githubusercontent.com/cybertize/doctype/default/plugins/sslibev/disable_libev.sh'
wget -q -O /usr/local/plugins/enable-ss.sh 'https://raw.githubusercontent.com/cybertize/doctype/default/plugins/sslibev/enable_libev.sh'
wget -q -O /usr/local/plugins/delete-ss.sh 'https://raw.githubusercontent.com/cybertize/doctype/default/plugins/sslibev/delete_libev.sh'

# v2ray & xray [trojan, vless, vmess]
wget -q -O /usr/local/plugins/add-tr.sh 'https://raw.githubusercontent.com/cybertize/doctype/default/plugins/v2ray/add_tr.sh'
wget -q -O /usr/local/plugins/renew-tr.sh 'https://raw.githubusercontent.com/cybertize/doctype/default/plugins/v2ray/renew_tr.sh'
wget -q -O /usr/local/plugins/lists-tr.sh 'https://raw.githubusercontent.com/cybertize/doctype/default/plugins/v2ray/lists_tr.sh'
wget -q -O /usr/local/plugins/delete-tr.sh 'https://raw.githubusercontent.com/cybertize/doctype/default/plugins/v2ray/delete_tr.sh'

wget -q -O /usr/local/plugins/add-vl.sh 'https://raw.githubusercontent.com/cybertize/doctype/default/plugins/v2ray/add_vl.sh'
wget -q -O /usr/local/plugins/renew-vl.sh 'https://raw.githubusercontent.com/cybertize/doctype/default/plugins/v2ray/renew_vl.sh'
wget -q -O /usr/local/plugins/lists-vl.sh 'https://raw.githubusercontent.com/cybertize/doctype/default/plugins/v2ray/lists_vl.sh'
wget -q -O /usr/local/plugins/delete-vl.sh 'https://raw.githubusercontent.com/cybertize/doctype/default/plugins/v2ray/delete_vl.sh'

wget -q -O /usr/local/plugins/add-vm.sh 'https://raw.githubusercontent.com/cybertize/doctype/default/plugins/v2ray/add_vm.sh'
wget -q -O /usr/local/plugins/renew-vm.sh 'https://raw.githubusercontent.com/cybertize/doctype/default/plugins/v2ray/renew_vm.sh'
wget -q -O /usr/local/plugins/lists-vm.sh 'https://raw.githubusercontent.com/cybertize/doctype/default/plugins/v2ray/lists_vm.sh'
wget -q -O /usr/local/plugins/delete-vm.sh 'https://raw.githubusercontent.com/cybertize/doctype/default/plugins/v2ray/delete_vm.sh'

# wireguard
wget -q -O /usr/local/plugins/add-wg.sh 'https://raw.githubusercontent.com/cybertize/doctype/default/plugins/wireguard/add_wg.sh'
wget -q -O /usr/local/plugins/renew-wg.sh 'https://raw.githubusercontent.com/cybertize/doctype/default/plugins/wireguard/renew_wg.sh'
wget -q -O /usr/local/plugins/lists-wg.sh 'https://raw.githubusercontent.com/cybertize/doctype/default/plugins/wireguard/lists_wg.sh'
wget -q -O /usr/local/plugins/delete-wg.sh 'https://raw.githubusercontent.com/cybertize/doctype/default/plugins/wireguard/delete_wg.sh'

# packages & services
wget -q -O /usr/local/plugins/dropbear.sh 'https://raw.githubusercontent.com/cybertize/doctype/default/plugins/service/dropbear.sh'
wget -q -O /usr/local/plugins/openvpn.sh 'https://raw.githubusercontent.com/cybertize/doctype/default/plugins/service/openvpn.sh'
wget -q -O /usr/local/plugins/squid.sh 'https://raw.githubusercontent.com/cybertize/doctype/default/plugins/service/squid.sh'
wget -q -O /usr/local/plugins/stunnel.sh 'https://raw.githubusercontent.com/cybertize/doctype/default/plugins/service/stunnel.sh'
wget -q -O /usr/local/plugins/libev.sh 'https://raw.githubusercontent.com/cybertize/doctype/default/plugins/service/libev.sh'
wget -q -O /usr/local/plugins/v2ray.sh 'https://raw.githubusercontent.com/cybertize/doctype/default/plugins/service/v2ray.sh'
wget -q -O /usr/local/plugins/wireguard.sh 'https://raw.githubusercontent.com/cybertize/doctype/default/plugins/service/wireguard.sh'
wget -q -O /usr/local/plugins/ohpserver.sh 'https://raw.githubusercontent.com/cybertize/doctype/default/plugins/service/ohpserver.sh'
wget -q -O /usr/local/plugins/websocket.sh 'https://raw.githubusercontent.com/cybertize/doctype/default/plugins/service/websocket.sh'

# server
wget -q -O /usr/local/plugins/cloudflare.sh 'https://raw.githubusercontent.com/cybertize/doctype/default/plugins/server/cloudflare.sh'
wget -q -O /usr/local/plugins/digitalocean.sh 'https://raw.githubusercontent.com/cybertize/doctype/default/plugins/server/digitalocean.sh'
wget -q -O /usr/local/plugins/detail.sh 'https://raw.githubusercontent.com/cybertize/doctype/default/plugins/server/detail.sh'
wget -q -O /usr/local/plugins/backup.sh 'https://raw.githubusercontent.com/cybertize/doctype/default/plugins/server/backup.sh'
wget -q -O /usr/local/plugins/restore.sh 'https://raw.githubusercontent.com/cybertize/doctype/default/plugins/server/restore.sh'
wget -q -O /usr/local/plugins/tcpbbr.sh 'https://raw.githubusercontent.com/cybertize/doctype/default/plugins/server/tcpbbr.sh'
wget -q -O /usr/local/plugins/wondershaper.sh 'https://raw.githubusercontent.com/cybertize/doctype/default/plugins/server/wondershaper.sh'
wget -q -O /usr/local/bin/speedtest 'https://raw.githubusercontent.com/cybertize/doctype/default/plugins/server/speedtest_cli.py' &&\
chmod +x /usr/local/bin/speedtest
